// handle the form submit event
function prepareEventHandlers() {
	document.getElementById("fourm").onsubmit = function() {
		// prevent a form from submitting if no email.
		if (document.getElementById("email").value == "" || document.getElementById("name1").value == "" || document.getElementById("gender").value == "") {
			document.getElementById("errorMessage").innerHTML = "plaesa fill all of the fields </br><div id ='p1'>first name </br> gender</br> birth year</br>email address</div>";
			// to STOP the form from submitting
			return false;
		} else {
			// reset and allow the form to submit
			document.getElementById("errorMessage").innerHTML = "";
			return true;
		}
	};
}





function preparePage() {
	
	document.getElementById("box1").style.display = "none";
	document.getElementById("job").onclick = function() {
		if (document.getElementById("job").checked) {
			// use CSS style to show it
			document.getElementById("box1").style.display = "block";
		} else {
			// hide the div
			document.getElementById("box1").style.display = "none";
		}
	};
	// now hide it on the initial page load.
	
}

window.onload =  function() {
	preparePage();
	prepareEventHandlers();

};
